<?php
namespace SisGG\FinalBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraint as Assert;
/**
 * @ORM\Entity
 */
class ItemPedido implements \Serializable
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
     
    /**
     * @ORM\Column(type="decimal", precision=2, scale=1)
     */
    private $precio;
     /**
     * @ORM\ManyToOne(targetEntity="ProductoVenta")
     * @ORM\JoinColumn(name="productoventa_id", referencedColumnName="id")
     */
    private $productoVenta;
     /**
     * @ORM\ManyToMany(targetEntity="Ingrediente")
     * @ORM\JoinTable(name="itempedido_ingrediente",
     *      joinColumns={@ORM\JoinColumn(name="ingrediente_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="itempedido_id", referencedColumnName="id")}
     *      )
     */
    private $ingredientes;
    
    /**
     * @return string
     */
    public function serialize()
    {
      return serialize($this->id);
    }

    /**
     * @param string $data
     */
    public function unserialize($data)
    {
      $this->id = unserialize($data);
    }
    
    
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->ingredientes = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set precio
     *
     * @param float $precio
     * @return ItemPedido
     */
    public function setPrecio($precio)
    {
        $this->precio = $precio;
    
        return $this;
    }

    /**
     * Get precio
     *
     * @return float 
     */
    public function getPrecio()
    {
        return $this->precio;
    }

    /**
     * Set productoVenta
     *
     * @param SisGG\FinalBundle\Entity\ProductoVenta $productoVenta
     * @return ItemPedido
     */
    public function setProductoVenta(\SisGG\FinalBundle\Entity\ProductoVenta $productoVenta = null)
    {
        $this->productoVenta = $productoVenta;
    
        return $this;
    }

    /**
     * Get productoVenta
     *
     * @return SisGG\FinalBundle\Entity\ProductoVenta 
     */
    public function getProductoVenta()
    {
        return $this->productoVenta;
    }

    /**
     * Add ingredientes
     *
     * @param SisGG\FinalBundle\Entity\Ingrediente $ingredientes
     * @return ItemPedido
     */
    public function addIngrediente(\SisGG\FinalBundle\Entity\Ingrediente $ingredientes)
    {
        $this->ingredientes[] = $ingredientes;
    
        return $this;
    }

    /**
     * Remove ingredientes
     *
     * @param SisGG\FinalBundle\Entity\Ingrediente $ingredientes
     */
    public function removeIngrediente(\SisGG\FinalBundle\Entity\Ingrediente $ingredientes)
    {
        $this->ingredientes->removeElement($ingredientes);
    }

    /**
     * Get ingredientes
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getIngredientes()
    {
        return $this->ingredientes;
    }
}